<?php
/* @var $this RoleController */
/* @var $model Role */
/* @var $form CActiveForm */
?>

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'role-form',
	// Please note: When you enable ajax validation, make sure the corresponding
	// controller action is handling ajax validation correctly.
	// There is a call to performAjaxValidation() commented in generated controller code.
	// See class documentation of CActiveForm for details on this.
	'enableAjaxValidation'=>false,
	'enableClientValidation'=>true,
	'clientOptions'=>array(
		'validateOnSubmit'=>true,)	
)); ?>

	<p class="note">All fields are required.</p>

	<?php echo $form->errorSummary($model); ?>

<div id="create-table">
	<table>

		<tr>
			<td >
				Name:
			</td>
			<td >			
				<?php echo $form->textField($model,'name',array('size'=>30,'maxlength'=>45)); ?>
				<?php echo $form->error($model,'name'); ?>
			</td>
		</tr>
		
		<tr>
			<td >
				Can Create/Edit Roles:			
			</td>
			<td >
				<?php echo $form->dropDownList($model, 'can_create_edit_roles',
												array('1'=>'Yes',
													  '0'=>'No',
													  ),
												array('empty'=>'','class'=>'dropbinary'));?>	
				<?php echo $form->error($model,'can_create_edit_roles'); ?>
			</td>
		</tr>

		
		<tr>
			<td >
				Can Create/Edit Users:		
			</td>
			<td >
				<?php echo $form->dropDownList($model, 'can_create_edit_users',
												array('1'=>'Yes',
													  '0'=>'No',
													  ),
												array('empty'=>'','class'=>'dropbinary'));?>	
				<?php echo $form->error($model,'can_create_edit_users'); ?>
			</td>
		</tr>
			
		
		<tr>
			<td >
				Can Create/Edit Shifts:		
			</td>
			<td >
				<?php echo $form->dropDownList($model, 'can_create_edit_shifts',
												array('1'=>'Yes',
													  '0'=>'No',
													  ),
												array('empty'=>'','class'=>'dropbinary'));?>
				<?php echo $form->error($model,'can_create_edit_shifts'); ?>											
			</td>
		</tr>	
		
		<tr>
			<td >
				Can Create/Edit Q-Shifts:		
			</td>
			<td >
				<?php echo $form->dropDownList($model, 'can_create_edit_qshifts',
												array('1'=>'Yes',
													  '0'=>'No',
													  ),
												array('empty'=>'','class'=>'dropbinary'));?>	
				<?php echo $form->error($model,'can_create_edit_qshifts'); ?>											
			</td>
		</tr>	
		
		<tr>
			<td >
				Can Create Callbacks:		
			</td>
			<td >
				<?php echo $form->dropDownList($model, 'can_create_callbacks',
												array('1'=>'Yes',
													  '0'=>'No',
													  ),
												array('empty'=>'','class'=>'dropbinary'));?>	
				<?php echo $form->error($model,'can_create_callbacks'); ?>											
			</td>
		</tr>
			
		<tr>
			<td >
				Can Edit Callbacks:		
			</td>
			<td >
				<?php echo $form->dropDownList($model, 'can_edit_callbacks',
												array('1'=>'Yes',
													  '0'=>'No',
													  ),
												array('empty'=>'','class'=>'dropbinary'));?>	
				<?php echo $form->error($model,'can_edit_callbacks'); ?>											
			</td>
		</tr>
				
		<tr>
			<td >
				Can Create Shift Change:		
			</td>
			<td >
				<?php echo $form->dropDownList($model, 'can_create_shift_change',
												array('1'=>'Yes',
													  '0'=>'No',
													  ),
												array('empty'=>'','class'=>'dropbinary'));?>	
				<?php echo $form->error($model,'can_create_shift_change'); ?>											
			</td>
		</tr>
								
		<tr>
			<td >
				Can Edit Shift Change:		
			</td>
			<td >
				<?php echo $form->dropDownList($model, 'can_edit_shift_change',
												array('1'=>'Yes',
													  '0'=>'No',
													  ),
												array('empty'=>'','class'=>'dropbinary'));?>	
				<?php echo $form->error($model,'can_edit_shift_change'); ?>											
			</td>
		</tr>
						
		<tr>
			<td >
				Can Create Q-Shift Change:		
			</td>
			<td >
				<?php echo $form->dropDownList($model, 'can_create_qshift_change',
												array('1'=>'Yes',
													  '0'=>'No',
													  ),
												array('empty'=>'','class'=>'dropbinary'));?>	
				<?php echo $form->error($model,'can_create_qshift_change'); ?>											
			</td>
		</tr>
						
		<tr>
			<td >
				Can Edit Q-Shift Change:		
			</td>
			<td >
				<?php echo $form->dropDownList($model, 'can_edit_qshift_change',
												array('1'=>'Yes',
													  '0'=>'No',
													  ),
												array('empty'=>'','class'=>'dropbinary'));?>	
				<?php echo $form->error($model,'can_edit_qshift_change'); ?>											
			</td>
		</tr>	
		
	<?php if(!(Yii::app()->user->restricted)): ?>
		<tr>
			<td >
				Team:		
			</td>
			<td >
					
			<?php		
			  echo $form->dropDownList($model,
									   'team_id',
									   CHtml::listData(Team::model()->findAll(),'idteam','short_name'),
									   array('empty'=>'','class'=>'dropteam')
									   ); 		
			  echo $form->error($model,'team_id'); 
			?>		
			</td>
		</tr>			
	<?php else:	?>		
		<tr>
			<td >
					
			<?php		
			  echo $form->dropDownList($model,
									   'team_id',
									   CHtml::listData(Team::model()->findAll(),'idteam','short_name'),
									   array('empty'=>'','class'=>'dropteam','style'=> 'display:none',)
									   ); 		
			  echo $form->error($model,'team_id'); 
			?>		
			</td>
		</tr>		
	<?php endif;	?>			
	</table>
</div>
		
	<div class="buttons">
		<br>
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->